import { deleteByPrimaryKeyForProOperlog, selectByPrimaryKeyForProOperlog, insertForProOperlog, updateForProOperlog, deleteByMapForProOperlog,updateByMapForProOperlog, getOneForProOperlog,getAllForProOperlog,queryPageForProOperlog, countForProOperlog, insertBatchForProOperlog, deleteBatchForProOperlog,updateBatchForProOperlog } from '@/services/system/api_prooperlog';

export default {
    namespace: 'prooperlog',

    state: {
        data: {
            list: [],
            pagination: {},
        },
    },

    effects: {
            *delete_by_primarykey_for_prooperlog({ payload }, { call, put }) {
                const response = yield call(deleteByPrimaryKeyForProOperlog, payload);
                yield put({
                    type: 'deleteByPrimaryKeyForProOperlog',
                    payload: response,
                });

                const responsedata = yield call(queryPageForProOperlog, {});
                yield put({
                type: 'queryPageForProOperlog',
                payload: responsedata,
                });


            },
            *select_by_primarykey_for_prooperlog({ payload, callback }, { call, put }) {
                const response = yield call(selectByPrimaryKeyForProOperlog, payload);
                yield put({
                    type: 'selectByPrimaryKeyForProOperlog',
                    payload: response,
                });

                if (callback) callback();
            },
            *insert_for_prooperlog({ payload, callback }, { call, put }) {
                const response = yield call(insertForProOperlog, payload);
                yield put({
                    type: 'insertForProOperlog',
                    payload: response,
                });

                const responsedata = yield call(queryPageForProOperlog, {});
                yield put({
                type: 'queryPageForProOperlog',
                payload: responsedata,
                });

                if (callback) callback();
            },
            *update_for_prooperlog({ payload, callback }, { call, put }) {
                const response = yield call(updateForProOperlog, payload);
                yield put({
                    type: 'updateForProOperlog',
                    payload: response,
                });


                const responsedata = yield call(queryPageForProOperlog, {});
                yield put({
                type: 'queryPageForProOperlog',
                payload: responsedata,
                });

                if (callback) callback();
            },
            *delete_by_map_for_prooperlog({ payload, callback }, { call, put }) {
                const response = yield call(deleteByMapForProOperlog, payload);
                yield put({
                    type: 'deleteByMapForProOperlog',
                    payload: response,
                });


                const responsedata = yield call(queryPageForProOperlog, {});
                yield put({
                type: 'queryPageForProOperlog',
                payload: responsedata,
                });

                if (callback) callback();
            },
            *update_by_map_for_prooperlog({ payload, callback }, { call, put }) {
                const response = yield call(updateByMapForProOperlog, payload);
                yield put({
                    type: 'updateByMapForProOperlog',
                    payload: response,
                });


                const responsedata = yield call(queryPageForProOperlog, {});
                yield put({
                type: 'queryPageForProOperlog',
                payload: responsedata,
                });

                if (callback) callback();
            },
            *get_one_for_prooperlog({ payload, callback }, { call, put }) {
                const response = yield call(getOneForProOperlog, payload);
                yield put({
                    type: 'getOneForProOperlog',
                    payload: response,
                });

                if (callback) callback();
            },
            *get_all_for_prooperlog({ payload, callback }, { call, put }) {
                const response = yield call(getAllForProOperlog, payload);
                yield put({
                    type: 'getAllForProOperlog',
                    payload: response,
                });


                if (callback) callback();
            },
            *query_page_for_prooperlog({ payload, callback }, { call, put }) {
                const response = yield call(queryPageForProOperlog, payload);
                yield put({
                    type: 'queryPageForProOperlog',
                    payload: response,
                });

                if (callback) callback();
            },
            *count_for_prooperlog({ payload, callback }, { call, put }) {
                const response = yield call(countForProOperlog, payload);
                yield put({
                    type: 'countForProOperlog',
                    payload: response,
                });

                if (callback) callback();
            },
            *insert_batch_for_prooperlog({ payload, callback }, { call, put }) {
                const response = yield call(insertBatchForProOperlog, payload);
                yield put({
                    type: 'insertBatchForProOperlog',
                    payload: response,
                });


                const responsedata = yield call(queryPageForProOperlog, {});
                yield put({
                type: 'queryPageForProOperlog',
                payload: responsedata,
                });


                if (callback) callback();
            },
            *delete_batch_for_prooperlog({ payload, callback }, { call, put }) {
                const response = yield call(deleteBatchForProOperlog, payload);
                yield put({
                    type: 'deleteBatchForProOperlog',
                    payload: response,
                });

                const responsedata = yield call(queryPageForProOperlog, {});
                yield put({
                type: 'queryPageForProOperlog',
                payload: responsedata,
                });

                if (callback) callback();
            },
            *update_batch_for_prooperlog({ payload, callback }, { call, put }) {
                const response = yield call(updateBatchForProOperlog, payload);
                yield put({
                    type: 'updateBatchForProOperlog',
                    payload: response,
                });

                const responsedata = yield call(queryPageForProOperlog, {});
                yield put({
                type: 'queryPageForProOperlog',
                payload: responsedata,
                });

                if (callback) callback();
            },
            },

    reducers: {
        deleteByPrimaryKeyForProOperlog(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        selectByPrimaryKeyForProOperlog(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        insertForProOperlog(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        updateForProOperlog(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        deleteByMapForProOperlog(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        updateByMapForProOperlog(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        getOneForProOperlog(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        getAllForProOperlog(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        queryPageForProOperlog(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        countForProOperlog(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        insertBatchForProOperlog(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        deleteBatchForProOperlog(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        updateBatchForProOperlog(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
    },
};
